#pragma once

#include "fileio/ifile.h"

#include <windows.h>
#include <string>

namespace renderit
{
	namespace fileio
	{
		class win32_file : public ifile
		{
		public:
			win32_file(const std::string& filename, int flag, HANDLE hfile);

		public:
			virtual ~win32_file() {}

		public:
			//! close and release `this ifile`
			virtual void close() override;

		public:
			//! get size of file
			virtual long long size() override;

			//! read to buf
			virtual int read(char * buf, int size) override;

			//! write from buf
			virtual bool write(const char * buf, int size) override;

			//! seek
			virtual bool seek(long long offset, ESeekSet where) override;

			//! get current position
			virtual long long cur_pos() override;

		private:
			std::string name_;
			int flag_;

			HANDLE hfile_;
		};
	}
}